home *** CD-ROM | disk | FTP | other *** search
- global gMasterData, gDragSprites, gOutsideLocs, gInsideLocs, gBoardScore
-
- on initDragData
- set gDragSprites to [#firstSp: 4, #lastSp: 38, #moverSp: 48]
- set gOutsideLocs to [:]
- sort(gOutsideLocs)
- set gInsideLocs to [:]
- sort(gInsideLocs)
- set gBoardScore to 0
- getSpriteLocs()
- end
-
- on getSpriteLocs
- repeat with snum = the firstSp of gDragSprites to the lastSp of gDragSprites
- addProp(gOutsideLocs, snum, point(the locH of sprite snum, the locV of sprite snum))
- end repeat
- end
-
- on moveItem
- set xsprite to the clickOn
- set moveMember to the member of sprite xsprite
- set offsetH to the locH of sprite xsprite - the mouseH
- set offsetV to the locV of sprite xsprite - the mouseV
- set the member of sprite the moverSp of gDragSprites to moveMember
- set the loc of sprite xsprite to point(-999, -999)
- repeat while the mouseDown
- set the loc of sprite the moverSp of gDragSprites to point(the mouseH + offsetH, the mouseV + offsetV)
- updateStage()
- end repeat
- EvalTarget(xsprite)
- end
-
- on EvalTarget xsprite
- if sprite the moverSp of gDragSprites within 3 then
- setInside(xsprite)
- else
- setOutside(xsprite)
- end if
- end
-
- on newLocation xsprite
- end
-
- on setInside xsprite
- puppetSound("thingset")
- set offsetH to the locH of sprite the moverSp of gDragSprites - the mouseH
- set offsetV to the locV of sprite the moverSp of gDragSprites - the mouseV
- set vNewPoint to point(the mouseH + offsetH, the mouseV + offsetV)
- set the loc of sprite xsprite to vNewPoint
- set the loc of sprite the moverSp of gDragSprites to point(-999, -999)
- setaProp(gInsideLocs, xsprite, the loc of sprite xsprite)
- if getaProp(gOutsideLocs, xsprite) <> VOID then
- deleteProp(gOutsideLocs, xsprite)
- end if
- end
-
- on setOutside xsprite
- if inside(the loc of sprite the moverSp of gDragSprites, the rect of sprite 1) then
- puppetSound("thingset")
- set offsetH to the locH of sprite the moverSp of gDragSprites - the mouseH
- set offsetV to the locV of sprite the moverSp of gDragSprites - the mouseV
- set vNewPoint to point(the mouseH + offsetH, the mouseV + offsetV)
- set the loc of sprite xsprite to vNewPoint
- set the loc of sprite the moverSp of gDragSprites to point(-999, -999)
- else
- puppetSound("swoosh")
- set vOrigLoc to getaProp(gOutsideLocs, xsprite)
- set the loc of sprite xsprite to vOrigLoc
- set the loc of sprite the moverSp of gDragSprites to point(-999, -999)
- end if
- setaProp(gOutsideLocs, xsprite, the loc of sprite xsprite)
- if getaProp(gInsideLocs, xsprite) <> VOID then
- deleteProp(gInsideLocs, xsprite)
- end if
- end
-
- on scoreCard scoreMode, xsprite
- set vFirstOne to the firstSp of gDragSprites
- case xsprite of
- vFirstOne:
- set thisScore to 5
- (vFirstOne + 1):
- set thisScore to 10
- (vFirstOne + 2):
- set thisScore to 5
- (vFirstOne + 3):
- set thisScore to -10
- (vFirstOne + 4):
- set thisScore to 10
- (vFirstOne + 5):
- set thisScore to -10
- (vFirstOne + 6):
- set thisScore to 10
- (vFirstOne + 7):
- set thisScore to 0
- (vFirstOne + 8):
- set thisScore to -10
- (vFirstOne + 9):
- set thisScore to -10
- (vFirstOne + 10):
- set thisScore to 0
- (vFirstOne + 11):
- set thisScore to 10
- (vFirstOne + 12):
- set thisScore to 10
- (vFirstOne + 13):
- set thisScore to 10
- (vFirstOne + 14):
- set thisScore to 0
- (vFirstOne + 15):
- set thisScore to 0
- (vFirstOne + 16):
- set thisScore to 10
- (vFirstOne + 17):
- set thisScore to 0
- (vFirstOne + 18):
- set thisScore to -5
- (vFirstOne + 19):
- set thisScore to 10
- (vFirstOne + 20):
- set thisScore to -10
- (vFirstOne + 21):
- set thisScore to -10
- (vFirstOne + 22):
- set thisScore to 0
- (vFirstOne + 23):
- set thisScore to -10
- (vFirstOne + 24):
- set thisScore to -10
- (vFirstOne + 25):
- set thisScore to 10
- otherwise:
- set thisScore to 0
- end case
- case scoreMode of
- #add:
- set gBoardScore to gBoardScore + thisScore
- #subtract:
- set gBoardScore to gBoardScore - thisScore
- end case
- end
-
- on resetItems
- repeat with x = 1 to count(gInsideLocs)
- set vSprite to getPropAt(gInsideLocs, x)
- set the loc of sprite vSprite to getProp(gInsideLocs, vSprite)
- end repeat
- repeat with x = 1 to count(gOutsideLocs)
- set vSprite to getPropAt(gOutsideLocs, x)
- set the loc of sprite vSprite to getProp(gOutsideLocs, vSprite)
- end repeat
- end
-